// pages/wj/add/addwj.js
var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    index: null,
    picker: ['是', '否'],
    index2: null,
    picker2: ['是', '否'],
    time: '12:01',
    date: '2018-12-25',
  },
  PickerChange(e) {
    console.log(e);
    this.setData({
      index: e.detail.value
    })
  },
  PickerChange2(e) {
    console.log(e);
    this.setData({
      index2: e.detail.value
    })
  },
  loginForm:function(e)
  {
    var form_value = e.detail.value;
    var bt = form_value.bt;
    var lm = form_value.lm;
    var gk = form_value.gk;
    var xzdjs = form_value.xzdjs;
    if(bt == '' || lm == null || gk == null || xzdjs == '')
    {
      wx.showModal({
        content: '请输入必填项',
        showCancel: false
      });
    }
    else
    {
      if (!(/(^[0-9]\d*$)/.test(xzdjs))) {
        wx.showModal({
          content: '限制答卷数必须为正整数',
          showCancel: false
        });
        return false;
      }
      var ls_wj = [];
      ls_wj.push({
        wj_jbxx:form_value,
        wj_tm:[],
      })
      console.log(ls_wj);
      app.globalData.ls_wj = ls_wj;
      wx.navigateTo({
        url: "/pages/wj/addwt/addwt",
      })
    }
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var myDate = new Date();
    var month = parseInt(myDate.getMonth()) + 1;
    var day = parseInt(myDate.getDate()) + 1;
    var date = myDate.getFullYear() + "-" + month + "-" + day;
    this.setData({
      date: date,
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },
  DateChange:function(e){
    this.setData({
      date: e.detail.value,
    })
  },
  TimeChange:function(e)
  {
    this.setData({
      time: e.detail.value,
    })
  },
  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

 
})